import java.util.Scanner;



class Person {

    private String name;
    private int age;
    private boolean gender;
    private int id;
   
    public Person(){
        System.out.println("This is constructor");
        System.out.printf("%s,%d,%s,%d%n", name,age,gender,id);
       
    }
   
    public Person(String name,int age, boolean gender) {
        this.name = name;
        this.gender = gender;
        this.age = age;
        //this.id = id;
    }
   
    public void setName(String name){
        this.name = name;
    }
   
    public String getName(){
        return name;
    }
   
    public void setGender(boolean gender){
        this.gender = gender;
    }

    public boolean getGender(){
        return gender;
    }
   
    public void setAge(int age){
        this.age = age;
    }
   
    public int getAge(){
        return age;
    }
   
    public String toString(){
        return String.format("Person [name=%s, age=%d, gender=%s, id=%d]", name,age,gender,id);
    }
   
}
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Person [] pe = new Person[n];
        for (int i = 0; i < pe.length; i++) {
            Person per = new Person(sc.next(),sc.nextInt(),sc.nextBoolean());
            pe[i] = per;
        }
        for(int i = pe.length-1 ; i>=0 ; i--){
            System.out.println(pe[i]);
        }
        System.out.println(new Person());
        sc.close();
    }
}




